package com.xc58.highreactor.server.core.constants;

import java.util.HashMap;

import com.google.common.base.Strings;
import com.xc58.highreactor.server.core.scanner.ServiceMapping;

public class Constants {
	private static String CLASS_PATH = null;
	private static HashMap<String,ServiceMapping> MAPPING = new HashMap<String,ServiceMapping>();
	
	public static void init(){
		getClassPath();
	}
	
	public static String getClassPath(){
		if(Strings.isNullOrEmpty(CLASS_PATH)){
			CLASS_PATH = System.getProperty("rpcClassPath");;
		}
		/*TODO judege class_path is null,
		 *     throw exception or use default
		 */
		return CLASS_PATH;
	}
	
	public static void addMapping(String name,ServiceMapping mapping){
		MAPPING.put(name, mapping);
	}
	
	public static ServiceMapping getMapping(String name){
		return MAPPING.get(name);
	}
	
	
}
